import com.xxd.EncryUtil
import com.xxd.SystemInfo
import org.springframework.core.io.ClassPathResource
import org.springframework.core.io.support.PropertiesLoaderUtils
import xxd.SysInitData

class BootStrap {


    def init = { servletContext ->
        if(!SystemInfo.getSysInfoMap().get(SystemInfo.DATA_VERSION)){
            def property = PropertiesLoaderUtils.loadProperties(new ClassPathResource("dataSource.properties"))
            SystemInfo.updateInfo(SystemInfo.DATA_VERSION,property.get(SystemInfo.DATA_VERSION))
            def da = this.getClass().getResourceAsStream("/sys.lic").getText()
            println "SystemInfo:${SystemInfo.getSysInfo()}  ReportBoard"
            SysInitData.isAvailable = EncryUtil.verify(da)
            println "Is Available:${SysInitData.isAvailable}  ReportBoard"
        }
    }
    def destroy = {
    }
}
